﻿using PTCN.CrossPlatform.BettingGame.Utilities;
using PTCN.CrossPlatform.BettingGame.Utilities.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SW.Webbase.MiniGame.Bingo.BingoLogic
{
    public class Pattern
    {

        public List<PatternData> ListPatternData { get; set; }

        /// <summary>
        /// Lấy danh sách partterns bongo được định nghĩa sẵn
        /// </summary>
        /// <returns></returns>
        public List<Pattern> getListPattern()
        {
            try
            {

                string[] p = FileUtil.readFile("DataConfig\\Patterns.txt");

                var lpt = new List<Pattern>();
                List<PatternData> lptData;
                string[] pConfig;
                foreach (string s in p)
                {
                    if (s.StartsWith("#") == true)
                        continue;
                    lptData = new List<PatternData>();
                    pConfig = s.Split('|');
                    foreach (string s1 in pConfig)
                    {
                        lptData.Add(new PatternData()
                        {
                            Row = int.Parse(s1.Split(',')[0]),
                            Col = int.Parse(s1.Split(',')[1]),
                        });
                    }

                    lpt.Add(new Pattern() { ListPatternData = lptData });
                }
                //Xong lưu vào bộ nhớ nhé, làm sau

                return lpt;
            }
            catch (Exception ex)
            {
                NLogManager.LogMessage("getListPattern error: " + ex.Message);
                return null;
            }
        }
    }


    public class PatternData
    {
        public int Row { get; set; }
        public int Col { get; set; }

       
    }   
}